Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bits as an optional feature for bitvec #446

Merged
merged 5 commits into from
Sep 5, 2024
Merged

Conversation

wcampbell0x2a
Copy link
Collaborator

@wcampbell0x2a wcampbell0x2a commented May 31, 2024

This is like the final boss of all my performance work. I try to explain the "no warranty and testing are given for the disable of this feature", while still implementing enough to make this useful in the case of "I want perf to matter".

image

bench: wcampbell0x2a/deku-bench#24

@wcampbell0x2a wcampbell0x2a changed the title DRAFT: Add bits feature DRAFT: Add bits as a feature May 31, 2024
Copy link

Benchmark for 4a76c64

Click to view benchmark
Test Base PR %
count 3.7±0.04µs N/A N/A
deku_read_bits 1320.4±7.58ns 1261.2±10.48ns -4.48%
deku_read_byte 3.4±0.22ns 3.3±0.08ns -2.94%
deku_read_enum 2.6±0.06ns 3.0±0.06ns +15.38%
deku_read_vec 35.5±2.29ns 35.2±0.54ns -0.85%
deku_write_bits 149.4±1.91ns 168.0±6.70ns +12.45%
deku_write_byte 22.0±0.28ns 21.9±0.29ns -0.45%
deku_write_enum 21.4±0.22ns 21.4±0.46ns 0.00%
deku_write_vec 387.5±4.44ns 330.7±5.39ns -14.66%
read_all 4.4±0.18µs N/A N/A
read_all_bytes 3.9±0.03µs N/A N/A

@wcampbell0x2a wcampbell0x2a changed the base branch from master to 439-improve-read-all-perf May 31, 2024 22:33
Copy link

Benchmark for 8947ee1

Click to view benchmark
Test Base PR %
count 3.7±0.04µs N/A N/A
deku_read_bits 1395.3±21.80ns 1285.8±42.23ns -7.85%
deku_read_byte 3.3±0.06ns 3.3±0.05ns 0.00%
deku_read_enum 2.6±0.06ns 3.0±0.06ns +15.38%
deku_read_vec 35.4±0.51ns 35.3±0.45ns -0.28%
deku_write_bits 161.1±5.19ns 146.4±4.32ns -9.12%
deku_write_byte 22.1±0.41ns 21.8±0.39ns -1.36%
deku_write_enum 21.4±0.23ns 21.4±0.41ns 0.00%
deku_write_vec 315.0±6.45ns 313.0±4.11ns -0.63%
read_all 4.4±0.06µs N/A N/A
read_all_bytes 3.9±0.06µs N/A N/A

Copy link

Benchmark for 755ed48

Click to view benchmark
Test Base PR %
count 3.7±0.03µs N/A N/A
deku_read_bits 1375.8±19.60ns 1303.6±38.98ns -5.25%
deku_read_byte 3.5±0.06ns 3.2±0.04ns -8.57%
deku_read_enum 3.0±0.09ns 2.6±0.05ns -13.33%
deku_read_vec 38.1±2.11ns 35.6±0.40ns -6.56%
deku_write_bits 160.4±4.86ns 175.5±5.04ns +9.41%
deku_write_byte 22.2±0.28ns 21.8±0.39ns -1.80%
deku_write_enum 21.4±0.19ns 21.4±0.45ns 0.00%
deku_write_vec 313.3±10.86ns 412.2±4.90ns +31.57%
read_all 4.2±0.06µs N/A N/A
read_all_bytes 5.0±0.04µs N/A N/A

@wcampbell0x2a wcampbell0x2a changed the title DRAFT: Add bits as a feature Add bits as an optional feature for bitvec May 31, 2024
@wcampbell0x2a wcampbell0x2a modified the milestones: 0.17.0, 0.18.0 May 31, 2024
Copy link

Benchmark for 6bea42b

Click to view benchmark
Test Base PR %
count 3.7±0.04µs 3.7±0.03µs 0.00%
deku_read_bits 1273.2±21.85ns 1285.2±21.64ns +0.94%
deku_read_byte 3.6±0.07ns 3.2±0.05ns -11.11%
deku_read_enum 3.0±0.04ns 2.6±0.06ns -13.33%
deku_read_vec 35.7±0.53ns 35.4±0.60ns -0.84%
deku_write_bits 150.4±2.19ns 160.7±6.36ns +6.85%
deku_write_byte 21.9±0.41ns 22.0±0.22ns +0.46%
deku_write_enum 21.4±0.19ns 21.4±0.37ns 0.00%
deku_write_vec 329.4±4.28ns 374.2±4.39ns +13.60%
read_all 4.4±0.04µs 4.2±0.05µs -4.55%
read_all_bytes 3.9±0.05µs 5.0±0.03µs +28.21%

@sharksforarms
Copy link
Owner

sharksforarms commented Aug 9, 2024

I think the warning is fair, although, what needs to be done to have more assurance and remove that warning?

@wcampbell0x2a
Copy link
Collaborator Author

I think the warning is fair, although, what needs to be done to have more assurance and remove that warning?

I updated this code to behave with running cargo test --lib --examples --tests --features std --no-default-features, and added it to CI. This way I am more confident that this options works.

@@ -22,6 +22,8 @@ jobs:
- run: cargo test --all
# run examples
- run: cargo run --example 2>&1 | grep -P ' ' | awk '{print $1}' | xargs -i cargo run --example {}
# test with no bits feature (don't test docs)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

sharksforarms
sharksforarms previously approved these changes Sep 3, 2024
Copy link
Owner

@sharksforarms sharksforarms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice, thank you

Base automatically changed from 439-improve-read-all-perf to master September 4, 2024 02:50
@wcampbell0x2a wcampbell0x2a dismissed sharksforarms’s stale review September 4, 2024 02:50

The base branch was changed.

@wcampbell0x2a wcampbell0x2a force-pushed the add-bits-feature branch 4 times, most recently from 6feb4f3 to 75b4894 Compare September 4, 2024 03:46
@wcampbell0x2a wcampbell0x2a changed the base branch from master to fix-ci September 4, 2024 03:47
@wcampbell0x2a wcampbell0x2a force-pushed the add-bits-feature branch 2 times, most recently from 569346f to 912a993 Compare September 4, 2024 03:52
Copy link

github-actions bot commented Sep 4, 2024

Benchmark for c7c2498

Click to view benchmark
Test Base PR %
count 3.4±0.03µs 3.6±0.07µs +5.88%
deku_read_bits 1119.2±10.17ns 1141.7±43.54ns +2.01%
deku_read_byte 3.6±0.07ns 3.4±0.10ns -5.56%
deku_read_enum 3.7±0.60ns 3.1±0.05ns -16.22%
deku_read_vec 31.7±0.19ns 30.3±0.48ns -4.42%
deku_write_bits 185.0±3.43ns 174.4±3.74ns -5.73%
deku_write_byte 24.6±0.33ns 24.1±0.47ns -2.03%
deku_write_enum 22.6±0.25ns 22.7±0.38ns +0.44%
deku_write_vec 411.1±5.49ns 434.7±11.80ns +5.74%
read_all 3.8±0.07µs 5.5±0.04µs +44.74%
read_all_bytes 5.5±0.01µs 3.8±0.06µs -30.91%

Copy link

github-actions bot commented Sep 4, 2024

Benchmark for c7c2498

Click to view benchmark
Test Base PR %
count 3.6±0.02µs 3.6±0.01µs 0.00%
deku_read_bits 1139.0±18.04ns 1137.2±8.55ns -0.16%
deku_read_byte 3.4±0.04ns 3.4±0.07ns 0.00%
deku_read_enum 3.1±0.05ns 3.1±0.04ns 0.00%
deku_read_vec 32.1±0.29ns 31.1±0.45ns -3.12%
deku_write_bits 182.8±2.77ns 186.8±4.35ns +2.19%
deku_write_byte 24.5±0.20ns 24.6±0.47ns +0.41%
deku_write_enum 22.7±0.39ns 22.6±0.29ns -0.44%
deku_write_vec 442.2±6.51ns 427.6±5.69ns -3.30%
read_all 5.5±0.03µs 5.6±0.07µs +1.82%
read_all_bytes 3.8±0.04µs 3.8±0.05µs 0.00%

Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 8082ea9

Click to view benchmark
Test Base PR %
count 3.6±0.02µs 3.4±0.02µs -5.56%
deku_read_bits 1133.0±6.02ns 1112.8±16.10ns -1.78%
deku_read_byte 3.4±0.08ns 3.6±0.04ns +5.88%
deku_read_enum 3.2±0.09ns 3.5±0.03ns +9.38%
deku_read_vec 32.5±0.43ns 31.6±0.33ns -2.77%
deku_write_bits 199.3±3.34ns 183.7±2.91ns -7.83%
deku_write_byte 25.0±0.46ns 24.1±0.35ns -3.60%
deku_write_enum 22.8±0.33ns 22.6±0.18ns -0.88%
deku_write_vec 438.2±6.19ns 409.3±4.81ns -6.60%
read_all 5.6±0.02µs 3.8±0.05µs -32.14%
read_all_bytes 3.8±0.06µs 5.6±0.06µs +47.37%

Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 8082ea9

Click to view benchmark
Test Base PR %
count 3.4±0.02µs 3.6±0.02µs +5.88%
deku_read_bits 1139.9±12.96ns 1145.6±13.99ns +0.50%
deku_read_byte 3.6±0.07ns 3.5±0.29ns -2.78%
deku_read_enum 3.5±0.04ns 3.1±0.10ns -11.43%
deku_read_vec 31.8±0.45ns 30.8±0.60ns -3.14%
deku_write_bits 197.7±4.11ns 195.6±3.56ns -1.06%
deku_write_byte 24.5±0.33ns 24.6±0.32ns +0.41%
deku_write_enum 22.6±0.34ns 23.3±0.29ns +3.10%
deku_write_vec 415.1±5.81ns 434.1±4.64ns +4.58%
read_all 3.9±0.05µs 5.5±0.03µs +41.03%
read_all_bytes 5.6±0.04µs 3.9±0.06µs -30.36%

with:
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
defaultFeatures: false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option doesn't seem to be adding --no-default-features like it should :/

idk javascript: /~https://github.com/boa-dev/criterion-compare-action/blob/59f4d964c5f19d7f13d36f5c0944b18ce6652cb0/main.js#L37

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I fixed it, i'll try out my test version here...

boa-dev/criterion-compare-action#117

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't fix it, guess I won't become a js dev anytime soon 😆

@wcampbell0x2a wcampbell0x2a force-pushed the add-bits-feature branch 2 times, most recently from a1d31d0 to 1c7b605 Compare September 4, 2024 04:26
Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 91baeb0

Click to view benchmark
Test Base PR %
count 3.6±0.01µs 3.7±0.02µs +2.78%
deku_read_bits 1180.1±16.54ns 1133.3±21.38ns -3.97%
deku_read_byte 3.4±0.12ns 3.4±0.11ns 0.00%
deku_read_enum 3.1±0.04ns 3.1±0.06ns 0.00%
deku_read_vec 30.4±0.60ns 31.8±1.03ns +4.61%
deku_write_bits 188.1±2.74ns 213.7±8.74ns +13.61%
deku_write_byte 24.7±0.91ns 24.1±0.48ns -2.43%
deku_write_enum 22.7±0.39ns 22.6±0.35ns -0.44%
deku_write_vec 413.6±10.55ns 413.1±8.07ns -0.12%
read_all 5.6±0.03µs 5.5±0.05µs -1.79%
read_all_bytes 3.8±0.12µs 3.8±0.10µs 0.00%

Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 91baeb0

Click to view benchmark
Test Base PR %
count 3.6±0.13µs 3.6±0.02µs 0.00%
deku_read_bits 1158.1±14.06ns 1165.7±29.54ns +0.66%
deku_read_byte 3.4±0.13ns 3.4±0.08ns 0.00%
deku_read_enum 3.1±0.04ns 3.1±0.02ns 0.00%
deku_read_vec 31.0±0.70ns 31.1±0.45ns +0.32%
deku_write_bits 191.5±3.97ns 195.3±10.10ns +1.98%
deku_write_byte 24.6±0.32ns 24.8±1.40ns +0.81%
deku_write_enum 22.8±1.01ns 22.7±0.33ns -0.44%
deku_write_vec 612.3±4.22ns 412.5±6.40ns -32.63%
read_all 5.5±0.03µs 3.8±0.06µs -30.91%
read_all_bytes 3.8±0.06µs 5.5±0.04µs +44.74%

Base automatically changed from fix-ci to master September 4, 2024 12:28
An error occurred while trying to automatically change base from fix-ci to master September 4, 2024 12:28
Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 2f63882

Click to view benchmark
Test Base PR %
count 3.6±0.01µs 3.6±0.02µs 0.00%
deku_read_bits 1138.6±18.05ns 1132.1±17.82ns -0.57%
deku_read_byte 3.4±0.05ns 3.5±0.13ns +2.94%
deku_read_enum 3.1±0.02ns 3.1±0.05ns 0.00%
deku_read_vec 31.7±0.48ns 34.4±1.68ns +8.52%
deku_write_bits 205.6±17.15ns 190.6±4.81ns -7.30%
deku_write_byte 24.6±0.19ns 25.4±1.67ns +3.25%
deku_write_enum 22.7±0.42ns 22.8±0.38ns +0.44%
deku_write_vec 418.6±6.53ns 420.3±6.71ns +0.41%
read_all 5.5±0.02µs 3.8±0.06µs -30.91%
read_all_bytes 3.8±0.08µs 5.5±0.03µs +44.74%

@wcampbell0x2a wcampbell0x2a force-pushed the add-bits-feature branch 2 times, most recently from 6fe89e4 to 3af1acf Compare September 4, 2024 13:08
@wcampbell0x2a wcampbell0x2a changed the base branch from master to fix-read-all-span September 4, 2024 13:08
Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 920345e

Click to view benchmark
Test Base PR %
count 3.6±0.01µs 3.6±0.01µs 0.00%
deku_read_bits 1145.2±11.17ns 1124.9±12.50ns -1.77%
deku_read_byte 3.4±0.08ns 3.4±0.07ns 0.00%
deku_read_enum 3.1±0.04ns 3.1±0.05ns 0.00%
deku_read_vec 31.0±0.49ns 32.2±0.35ns +3.87%
deku_write_bits 182.2±4.09ns 179.9±4.24ns -1.26%
deku_write_byte 24.6±0.42ns 24.3±0.47ns -1.22%
deku_write_enum 22.6±0.35ns 22.6±0.28ns 0.00%
deku_write_vec 410.3±6.12ns 411.3±3.43ns +0.24%
read_all 5.5±0.03µs 5.6±0.02µs +1.82%
read_all_bytes 3.8±0.06µs 3.8±0.04µs 0.00%

Copy link

github-actions bot commented Sep 4, 2024

Benchmark for f998f16

Click to view benchmark
Test Base PR %
count 3.4±0.02µs 3.4±0.02µs 0.00%
deku_read_bits 1141.2±15.34ns 1105.0±25.97ns -3.17%
deku_read_byte 3.6±0.15ns 3.6±0.08ns 0.00%
deku_read_enum 3.5±0.04ns 3.5±0.06ns 0.00%
deku_read_vec 31.7±0.51ns 31.7±0.47ns 0.00%
deku_write_bits 196.0±4.13ns 179.3±4.26ns -8.52%
deku_write_byte 24.6±0.52ns 24.2±0.41ns -1.63%
deku_write_enum 22.6±0.18ns 22.7±0.38ns +0.44%
deku_write_vec 411.5±6.98ns 435.4±10.70ns +5.81%
read_all 3.8±0.05µs 3.8±0.04µs 0.00%
read_all_bytes 5.6±0.03µs 5.5±0.08µs -1.79%

Base automatically changed from fix-read-all-span to master September 4, 2024 16:41
Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 45a4aea

Click to view benchmark
Test Base PR %
count 5.0±0.01µs 5.0±0.01µs 0.00%
deku_read_bits 1160.9±14.17ns 1140.3±20.76ns -1.77%
deku_read_byte 3.3±0.03ns 3.1±0.07ns -6.06%
deku_read_enum 3.2±0.08ns 3.2±0.03ns 0.00%
deku_read_vec 42.3±0.60ns 42.3±0.36ns 0.00%
deku_write_bits 185.0±4.46ns 195.7±5.50ns +5.78%
deku_write_byte 24.9±0.41ns 24.4±0.51ns -2.01%
deku_write_enum 23.5±0.33ns 23.0±0.62ns -2.13%
deku_write_vec 432.3±6.61ns 410.5±5.74ns -5.04%
read_all 5.5±0.02µs 5.5±0.02µs 0.00%
read_all_bytes 3.8±0.03µs 3.8±0.08µs 0.00%

Copy link

github-actions bot commented Sep 4, 2024

Benchmark for 07f5db4

Click to view benchmark
Test Base PR %
count 5.0±0.01µs 5.0±0.14µs 0.00%
deku_read_bits 1141.9±17.54ns 1122.1±10.32ns -1.73%
deku_read_byte 3.3±0.07ns 3.1±0.05ns -6.06%
deku_read_enum 3.2±0.03ns 3.2±0.04ns 0.00%
deku_read_vec 42.5±0.21ns 42.5±0.14ns 0.00%
deku_write_bits 184.3±3.97ns 196.0±3.19ns +6.35%
deku_write_byte 24.8±0.25ns 24.4±0.35ns -1.61%
deku_write_enum 23.5±0.50ns 23.0±0.36ns -2.13%
deku_write_vec 437.7±4.66ns 419.1±3.82ns -4.25%
read_all 5.5±0.01µs 5.5±0.03µs 0.00%
read_all_bytes 3.9±0.04µs 3.8±0.07µs -2.56%

@wcampbell0x2a wcampbell0x2a merged commit efbe7b4 into master Sep 5, 2024
15 checks passed
@wcampbell0x2a wcampbell0x2a deleted the add-bits-feature branch September 5, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants